package com.mg.axechen.lifecycles

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        // 通过注解获取activity生命周期回调
        lifecycle.addObserver(MyLifecycleObserver())

        // 通过onStateChanged的方式去获取生命周期回调
        lifecycle.addObserver(MyLifecycleObserver2())
    }
}